#pragma once
#include <string>
#include <unordered_set>
#include <vector>
class StringHelper {
public:
  static std::size_t split(const std::string &str, const std::string &sep,
                           std::vector<std::string> &res,
                           bool is_push_empty_string = false) {
    if (str.empty() || sep.empty())
      return 0;
    std::size_t pos, idx = 0;
    while (idx < str.size()) {
      pos = str.find(sep, idx);
      if (pos == std::string::npos) {
        res.push_back(str.substr(idx));
        break;
      }

      if (pos == idx && is_push_empty_string == false) {
        idx += sep.size();
        continue;
      }

      res.push_back(str.substr(idx, pos - idx));
      idx = pos + sep.size();
    }

    return res.size();
  }
 static bool OnlyIncludeChars(const std::string& target,const std::string& ops)
 {
    std::unordered_set<char> m(ops.begin(),ops.end());
    for(auto ch:target)
    {
        if(m.end()== m.find(ch))
        {
            return false;
        }
    }
    return true;
 }
};
